The present invention relates to an image drawing method, and an image drawing apparatus which make it possible to draw images of shadows produced by light emission from a light source based on a positional relationship of a plurality of objects generated by three-dimensional modeling such that shadow images of objects positioned near the light source are drawn on other objects positioned distantly from the light source. Further, the present invention relates to a recording medium which stores a program for carrying out such image processing, and the program itself.
In recent years, there has been a rapid advancement of computer graphics techniques, such as hidden line removal, hidden surface removal, smooth shading, and texture mapping thanks to the dramatic development of hardware.
Generally, with computer graphics techniques, images are generated by the following procedure. Firstly, a plurality of three-dimensional objects are generated by three-dimensional modeling. Then, rendering is performed by adding optical properties such as specular reflection, diffuse reflection, refraction, and transparency to the objects using shading techniques, by adding surface patterns to the objects, and by plotting images depending on surroundings, such as a window and scenery reflections and ambient light.
It is difficult to perform a process of expressing a shadow of an object cast on another object positioned therebehind based on the layout of a light source and a plurality of objects. One rendering technique for performing the process is ray tracing. However, such a technique requires highly complicated calculations which put CPUS or the like under heavy load. Another rendering technique for expressing a shadow utilizes a stencil buffer. However, the technique requires a stencil buffer as an additional mask (memory). Further, the technique requires a process of extracting an area corresponding to a shadow from the stencil buffer and a process of drawing semi-transparent polygons in a blackish color in the extracted area. As a result, this technique requires a large number of processes.
If heavy load and complicated processes are to be avoided, such as for real time rendering, then it has heretofore been customary to approximate such a shadow with perspective projection onto a simple plane in a simple figure such as a circle.
The present invention has been made taking the above problem into account, and an object of which is to provide an image drawing method and an image drawing apparatus which make it possible to draw shadow images of a plurality objects in a complicated positional relationship, and draw a shadow image of a complicated object without any difficulties. Another object of the present invention is to provide a recording medium which stores a program for carrying out such image processing without any difficulties, and to provide the program itself.
According to the present invention, a method of drawing a shadow image of a three-dimensional object includes defining at least one primary surface of the three-dimensional object;
generating new secondary surfaces based on the primary surface utilizing a light source as a base point;
drawing a first image of a front-side secondary surface selected from the secondary surfaces; and
drawing a second image of a back-side secondary surface selected from the secondary surfaces, the second image being drawn so as to eliminate a portion of the first image, whereby a remaining portion of the first image constitutes the shadow image of the primary surface.
Further, according to the present invention, an apparatus for drawing a shadow image of a three-dimensional object includes
means for defining at least one primary surface of the three-dimensional object;
means for generating new secondary surfaces based on the primary surface utilizing a light source as a base point;
first means for drawing a first image of a front-side secondary surface selected from the secondary surfaces; and
second means for drawing a second image of a backside secondary surface selected from the secondary surfaces, the secondary image being drawn so as to eliminate a portion of the first image, whereby a remaining portion of the first image constitutes the shadow image of the primary surface.
Further, according to the present invention, a recording medium is recorded with a program and data for drawing image data in an image memory and outputting the image data from the image memory to a monitor. The program includes
defining at least one primary surface of the three-dimension object;
generating new secondary surfaces based on the primary surface utilizing a light source as a base point;
drawing a first image of a front-side secondary surface selected from the secondary surfaces; and
drawing a second image of a back-side secondary surface selected from the secondary surfaces, the second image being drawn so as to eliminate a portion of the first image, whereby a remaining portion of the first image constitutes the shadow image of the primary surface.
Further, according to the present invention, a program is readable and executable by a computer for operating an image drawing apparatus for drawing image data in an image memory and outputting the image data from the image memory to a monitor, the program including
defining at least one primary surface of the three-dimension object;
generating new secondary surfaces based on the primary surface utilizing a light source as a base point;
drawing a first image of a front-side secondary surface selected from the secondary surfaces; and
drawing a second image of a back-side secondary surface selected from the secondary surfaces, the second image being drawn so as to eliminate a portion of the first image, whereby a remaining portion of the first image constitutes the shadow image of the primary surface.
Accordingly, it is possible to easily generate shadow images of a plurality of objects in a complicated positional relationship, or generate a shadow image of an object having a complicated shape, without using a stencil buffer. Since the shadow image is generated when the second image is drawn so as to partially eliminate the first image, it is no longer necessary to draw semi-transparent polygons in a blackish color in the last step. Therefore, the number of processes can be effectively decreased. In particular, according to the present invention, three-dimensional information concerning an object on which a shadow is projected is not necessary in drawing a shadow image. That is, all that is needed is information concerning two-dimensional images in an image memory and Z-buffer values for respective pixels of the two-dimensional images.
According to the present invention, the primary surface may be drawn by rendering and hidden surface removal. Further, the first and second images of the secondary surfaces may be drawn by rendering and hidden surface removal. Preferably, Z-buffering is used in performing hidden surface removal.
Further, according to the present invention, a series of drawing processes, including drawing the primary surface, generating the secondary surfaces, and drawing the first and second images of the secondary surfaces, are performed for each of the primary surfaces constituting the three-dimensional object, thereby drawing both an image of the three-dimensional object and a shadow image of the three-dimensional object.
Further, according to the present invention, when there are a plurality of primary surfaces constituting at least one three-dimensional object, the series of drawing processes are performed for each of the primary surfaces in an order beginning with the primary surface farthest from the light source and ending with the primary surface closest the light source such that a shadow image of a primary surface is drawn on another primary surface.
Further, according to the present invention, when there are a plurality of three-dimensional objects, the series of drawing processes are performed for each of the three-dimensional objects in an order beginning with the three-dimensional object farthest from the light source and ending with the three-dimensional object closet to the light source such that a shadow image of at least one three-dimensional object is drawn on another three-dimensional object.
The above and other objects, features, and advantages of the present invention will become more apparent from the following description when taken in conjunction with the accompanying drawings in which a preferred embodiment of the present invention is shown by way of illustrative example.